import java.util.Stack;

public class Test {
    public static int evalRPN(String[] tokens) {
        Stack<String> s = new Stack();
        for(int i = 0;i<tokens.length;i++){
            if(!jude(tokens[i])){
                s.push(tokens[i]);
            }else{
                int num1 = Integer.parseInt(s.pop());
                int num2 = Integer.parseInt(s.pop());;
                switch (tokens[i]){
                    case "+":
                        String ret = String.valueOf(num2+num1);
                        s.push(ret);
                        break;
                    case "-":
                        ret = String.valueOf(num2-num1);
                        s.push(ret);
                        break;
                    case "*":
                        ret = String.valueOf(num2*num1);
                        s.push(ret);
                        break;
                    case "/":
                        ret = String.valueOf(num2/num1);
                        s.push(ret);
                        break;
                }
            }
        }
        int ret = Integer.parseInt(s.pop());
        return ret;
    }
    public static boolean jude(String s){
        if (s.equals("+") ||s.equals("-") ||s.equals("*") ||s.equals("/")) {
            return true;
        }
        return false;
    }

    public static void main(String[] args) {
        String[] s = {"4","13","5","/","+"};
        System.out.println(evalRPN(s));
    }
}
